package com.yq.cp.mapper.data;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yq.cp.entity.common.PageVo;
import com.yq.cp.entity.data.NengKongDataDay;
import com.yq.cp.entity.data.dto.*;
import com.yq.cp.entity.data.vo.IndexDataViewVo;
import com.yq.cp.entity.data.vo.IndexGfVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 能控数据 Mapper 接口
 * </p>
 *
 * @author zh
 * @since 2023-03-20
 */
public interface NengKongDataDayMapper extends BaseMapper<NengKongDataDay> {

    List<IndexDataSqlDto> getDayAllData(@Param("time") String time, @Param("state") Integer state, @Param("type") Integer classify, @Param("companyId") Integer companyId);

    List<IndexDataSqlByCompanyDto> getDataByCompany(@Param("timeState") Integer timeState, @Param("time") String time, @Param("state") Integer state);

    List<IndexDataSqlByCompanyDto> getDataByEnergy(@Param("timeState") Integer timeState, @Param("time") String time, @Param("state") Integer state,@Param("companyId") Integer companyId);

    List<IndexDataSqlDto> getAllDataByCompany(@Param("timeState") Integer timeState, @Param("time") String time, @Param("state") Integer state);

    List<IndexDataSqlDto> getAllDataByEnergy(@Param("timeState") Integer timeState, @Param("time") String time, @Param("state") Integer state,@Param("companyId") Integer companyId);

    List<IndexSqlDataViewDto> getDataView(IndexDataViewVo val);


    BigDecimal newest(@Param("n") NengKongDataDay nengKongDataDay);
    BigDecimal minimum(@Param("n") NengKongDataDay nengKongDataDay);

    BigDecimal lj(@Param("n") NengKongDataDay nengKongDataDay);

    BigDecimal grandTotal(@Param("n") NengKongDataDay nengKongDataDay);
    /**
     * 装机容量
     * */
    BigDecimal zj(@Param("n") NengKongDataDay nengKongDataDay);

    Long yxts(@Param("n") NengKongDataDay nengKongDataDay);


    /**
     * 查询当天的
     * */
    List<NengKongDataDay> query20(@Param("n") IndexGfVo indexGfVo);
    List<NengKongDataDay> query20111(@Param("n") IndexGfVo indexGfVo);
    List<NengKongDataDay> query20113(@Param("n") IndexGfVo indexGfVo);
    List<NengKongDataDay> query20114(@Param("n") IndexGfVo indexGfVo);

    /**
     * 查询当月的
     * */
    List<NengKongDataDay> query21(@Param("n") IndexGfVo indexGfVo);

    /**
     * 查询当年的
     * */
    List<NengKongDataDay> query22(@Param("n") IndexGfVo indexGfVo);
    /**
     * 查询所有年份的
     * */
    List<NengKongDataDay> query26(@Param("n") IndexGfVo indexGfVo);
    List<NengKongDataDay> query261(@Param("n") IndexGfVo indexGfVo);
    /**
     * 根据日期查询
     * */
    List<NengKongDataDay> query23(@Param("n") IndexGfVo indexGfVo);
    List<NengKongDataDay> query24(@Param("n") IndexGfVo indexGfVo);


    @Select("SELECT COUNT(a.id) FROM (SELECT id FROM t_neng_kong_data_day WHERE type=107 AND energy_id=#{energy_id} AND `value`>0 AND time=#{date} GROUP BY hour_number) a")
    Long jrxss(@Param("energy_id") Long energyId,@Param("date") String date);
    @Select("SELECT COUNT(a.id) FROM (SELECT id FROM t_neng_kong_data_day WHERE type=107 AND energy_id=#{energy_id} AND `value`>0  GROUP BY hour_number) a")
    Long ljxss(@Param("energy_id") Long energyId);
    BigDecimal qxzxz(@Param("energyId") Long energyId,@Param("date") String date);
    BigDecimal qxzdz(@Param("energyId") Long energyId,@Param("date") String date);



    BigDecimal qxzxz1(@Param("energyId") Long energyId,@Param("date") String date,@Param("type")Integer type);
    BigDecimal qxzdz1(@Param("energyId") Long energyId,@Param("date") String date,@Param("type")Integer type);
    BigDecimal qxzdz11(@Param("energyId") Long energyId,@Param("date") String date,@Param("type")Integer type);


    BigDecimal qxzxz19(@Param("energyId") Long energyId,@Param("date") String date,@Param("type")Integer type,@Param("hourNumber") Integer hourNumber);
    BigDecimal qxzdz19(@Param("energyId") Long energyId,@Param("date") String date,@Param("type")Integer type,@Param("hourNumber") Integer hourNumber);

    BigDecimal qxzxz191(@Param("energyId") Long energyId,@Param("macId") Long macId,@Param("date") String date,@Param("type")Integer type,@Param("hourNumber") Integer hourNumber);
    BigDecimal qxzdz191(@Param("energyId") Long energyId,@Param("macId") Long macId,@Param("date") String date,@Param("type")Integer type,@Param("hourNumber") Integer hourNumber);
    BigDecimal qxzxz122(@Param("energyId") Long energyId,@Param("macId") Long macId,@Param("date") String date,@Param("type")Integer type);
    BigDecimal qxzdz122(@Param("energyId") Long energyId,@Param("macId") Long macId,@Param("date") String date,@Param("type")Integer type);

    BigDecimal qxzxz11(@Param("energyId") Long energyId,@Param("macId") Long macId,@Param("date") String date,@Param("type")Integer type);
    BigDecimal qxzdz11(@Param("energyId") Long energyId,@Param("macId") Long macId,@Param("date") String date,@Param("type")Integer type);


    BigDecimal qxzxz3(@Param("energyId") Long energyId,@Param("type")Integer type,@Param("year") Integer year);
    BigDecimal qxzdz3(@Param("energyId") Long energyId,@Param("type")Integer type,@Param("year") Integer year);

    BigDecimal qxzxz322(@Param("energyId") Long energyId,@Param("macId") Long macId,@Param("type")Integer type,@Param("year") Integer year);
    BigDecimal qxzdz322(@Param("energyId") Long energyId,@Param("macId") Long macId,@Param("type")Integer type,@Param("year") Integer year);


    BigDecimal qxzxz31(@Param("energyId") Long energyId,@Param("type")Integer type,@Param("year") Integer year,@Param("month") Integer month);
    BigDecimal qxzdz31(@Param("energyId") Long energyId,@Param("type")Integer type,@Param("year") Integer year,@Param("month")Integer month);
    BigDecimal qxzxz3122(@Param("energyId") Long energyId,@Param("macId") Long macId,@Param("type")Integer type,@Param("year") Integer year,@Param("month") Integer month);
    BigDecimal qxzdz3122(@Param("energyId") Long energyId,@Param("macId") Long macId,@Param("type")Integer type,@Param("year") Integer year,@Param("month")Integer month);

    BigDecimal qxdqgl(@Param("energyId") Long energyId);
    BigDecimal qxdqgl1(@Param("energyId") Long energyId);


    List<EnergyAnalyseDto> list(@Param("val") EnergyAnalyseListVo val);

    /**
     * 查询电量
     * */
    BigDecimal cxdl(@Param("v") PageVo vo);
    /**
     * 查询金额
     * */
    BigDecimal cxje(@Param("v") PageVo vo);



    /**
     * 查询电量
     * */
    BigDecimal cxdl1(@Param("v") PageVo vo);
    /**
     * 查询金额
     * */
    BigDecimal cxje1(@Param("v") PageVo vo);

    @Select("SELECT MAX(`value`)-MIN(`value`) FROM t_neng_kong_data_day WHERE mac_id=#{sbId} AND type=#{type} AND `value`>0")
    BigDecimal cxljsj(@Param("sbId") Long sbId,@Param("type") Integer type);

    @Select("SELECT SUM(rate_of_work) FROM t_equipment_management WHERE site_id=#{id} AND is_delete=0 AND examine=1")
    BigDecimal nyzgl(@Param("id") Long id);

    BigDecimal cxdr(@Param("nyzId")Long nyzId, @Param("macId")Long macId, @Param("type")Integer type,@Param("date") Date date);

    BigDecimal cxcz(@Param("energyCode")String energyCode,@Param("macCode")String macCode, @Param("name")String name);
    BigDecimal mxsfdl(@Param("energyId")Long energyId,@Param("macId")String macId, @Param("type")Integer type, @Param("hour1")Integer hour1, @Param("hour2")Integer hour2);

    List<BigDecimal> cxdxxss(@Param("nyzId")Long nyzId,@Param("year") Integer year,@Param("month") Integer month);
    List<BigDecimal> cxdxxss1(@Param("nyzId")Long nyzId,@Param("year") Integer year);
    List<BigDecimal> cxdxxss2(@Param("nyzId")Long nyzId);


    BigDecimal cxcz1(@Param("v") IndexGfVo indexGfVo);
}
